/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package reppconn;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Nargisse
 * Class qui permet de mettre le contenu du fichier StopList.txt dans une arraylist
 * Elle possede une methode isTokenStopList(String ele) qui permet de verifier
 * si l'ele appartient a la stop liste
 */
public class StopList extends File{
    
    private String token = null;
    private BufferedReader br;
    // liste des mots appartenant a la stop liste
    private ArrayList<String> tokenStopList;
    
    public StopList() {
        //super("C:\\Users\\Nargisse\\Documents\\INSA_2013\\RI\\StopList.txt");
        super("C:\\Users\\Cyril\\Desktop\\ReppConn\\stopliste.txt");
        tokenStopList = new ArrayList<String>();
        storeStopListInArray();
    }
    
    private void storeStopListInArray(){
        try {
            br = new BufferedReader(new FileReader(this));
            
            while((token = br.readLine()) != null){
                tokenStopList.add(token);
            }
        } catch (IOException ex) {
            Logger.getLogger(StopList.class.getName()).log(Level.SEVERE, null, ex);
        }   
    }
    
    public boolean isTokenStopList(String ele){
        return tokenStopList.contains(ele);
    }
    
    //pas besoin
    /*public ArrayList<String> getTokenStopList(){
        return this.tokenStopList;
    }*/
}
